<?php
$title = '分类管理 - 支持二级分类';
include 'header.php';
?>
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-header">
                <a title="添加分类" href="./admin.class.add.php" class="badge badge-primary"><i class="layui-icon layui-icon-addition"></i></a>
                <a title="查看商品" href="./admin.goods.list.php" class="badge badge-success"><i class="layui-icon layui-icon-cart-simple"></i></a>
                <a title="批量设置" href="javascript:" mdui-menu="{target: '#BatchOperation'}" class="badge badge-success"><i class="layui-icon layui-icon-set"></i></a>
                <ul class="mdui-menu" id="BatchOperation">
                    <li class="mdui-menu-item">
                        <a href="javascript:App.BatchEditor(12);">
                            批量换图
                        </a>
                    </li>
                    <li class="mdui-menu-item">
                        <a style="font-size:0.8em;" href="javascript:App.BatchEditor(14);">
                            批量删除
                        </a>
                    </li>
                </ul>
                <a title="初始化" href="javascript:App.ClassList();" class="badge badge-warning"><i class="layui-icon layui-icon-refresh-3"></i></a>
                <a href="javascript:App.ResetSort()" class="btn btn-danger badge ml-1 pb-0" style="padding-bottom: 0.3em !important;">重置排序ID</a>
                <a href="javascript:App.DeleteClass()" class="btn btn-danger badge ml-1 pb-0" style="padding-bottom: 0.3em !important;">删除所有分类</a>
            </div>
            <div class="card-body" id="App">
                <div class="table-responsive" id="table">
                    <table class="table table-hover table-centered mb-0" style="font-size:0.9em;">
                        <thead>
                            <tr style="white-space: nowrap">
                                <th>操作</th>
                                <th>

                                    <input name="checkbox_all" id="list_all" type="checkbox" @click="select_all()" value="true">
                                    CID
                                </th>
                                <th>排序值 <a href="javascript:layer.alert('排序值越高，越靠前！',{icon:3})">[注]</a></th>
                                <th>分类名称</th>
                                <th>上级分类ID</th>
                                <th>商品数量</th>
                                <th>分类图片</th>
                                <th>分类状态</th>
                                <th>支持的付款方式(<a href="javascript:layer.alert('可点击对应的付款通道名称来开启或关闭!<hr><font color=red>商品列表批量操作内可批量设置商品参数，如开启关闭支持的支付通道等！</font><hr>优先级说明：<br>1、当商品关闭了在线支付方式后，此处的QQ,微信,支付宝通道配置均无效,全部算为关闭状态<br>2、当商品开启了余额或积分付款方式后，此处却关闭了余额积分付款方式，用户付款时也会无法使用余额，积分付款，必须两处同时开启！',{title:'帮助说明'})">帮助说明</a>)
                                </th>
                                <th>可见等级限制(<a href="javascript:layer.alert('当设置为1时，对所有等级的用户，包括游客开放，当设置为2时，对大于等于2级的用户开放，以此类推<hr>注：此功能仅带有显示隐藏效果，不会影响用户购买，如其他站点用户通过对接API购买商品，不会有任何限制！',{title:'帮助说明'})">帮助说明</a>)
                                </th>
                                <th>创建时间</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="(item,index) in Data" :class="'Tab_'+item.superior" :style="item.superior>=1?'display: none;':''">
                                <td>
                                    <a :href="'admin.class.add.php?cid='+item.cid" class="action-icon"> <i class="layui-icon layui-icon-set-fill"></i></a>
                                    <span title="删除商品" style="cursor:pointer;color: red" @click="ClassDelete(item.cid,item.name)" class="action-icon"> <i class="layui-icon layui-icon-delete"></i></span>
                                </td>
                                <td>
                                    <input type="checkbox" name="checkbox[]" :class="'list_box box_'+item.cid" @click="select_id(item.cid)" :value="item.cid" />
                                    {{item.cid}}
                                    </a>
                                </td>

                                <td>
                                    <input :onchange="'App.SortSet('+item.cid+',this)'" type="number" style="width: 50px;" class="layui-input" :value="item.sort">
                                </td>
                                <td>
                                    <a :href="'admin.goods.list.php?cid='+item.cid" target="_blank" style="color: red" title="打开分类">{{item.name}}</a>
                                </td>
                                <td>
                                    <span v-if="item.superior==-1" style="color: #999"><i :id="'Tab_'+item.cid" class="layui-icon layui-icon-right" @click="Deployment(item.cid,item.SuborderNumber)" v-if="item.SuborderNumber>=1" style="color:rgb(61,30,200);font-size: 90%;cursor: pointer">展开({{
                                            item.SuborderNumber }})</i>
                                        <span v-else>—</span>
                                    </span>
                                    <span v-else class="badge badge-primary-lighten">{{ item.superior }}</span>
                                </td>
                                <td>
                                    <span class="badge badge-primary-lighten" @click="BatchSetting(item.cid)" style="cursor: pointer;">{{item.count}}个(设置)</span>
                                </td>
                                <td>
                                    <img :src="item.image" style="width:3em" />
                                </td>
                                <td>
                                    <a v-if="item.state==1" @click="ClassStateSet(item.cid,2,item.name)" href="javascript:void" class="badge badge-success-lighten">显示中</a>
                                    <a v-if="item.state==2" href="javascript:void" @click="ClassStateSet(item.cid,1,item.name)" class="badge badge-danger-lighten">已隐藏</a>
                                </td>
                                <td style="cursor:pointer;white-space: nowrap">
                                    <span class="badge" @click="ClassPaySet(item.cid,0)" :class="item.support[0]==1?'badge-success-lighten':'badge-danger-lighten'">QQ</span>
                                    <span class="badge  ml-1 " @click="ClassPaySet(item.cid,1)" :class="item.support[1]==1?'badge-success-lighten':'badge-danger-lighten'">微信</span>
                                    <span class="badge  ml-1 " @click="ClassPaySet(item.cid,2)" :class="item.support[2]==1?'badge-success-lighten':'badge-danger-lighten'">支付宝</span>
                                    <span class="badge  ml-1 " @click="ClassPaySet(item.cid,3)" :class="item.support[3]==1?'badge-success-lighten':'badge-danger-lighten'">余额</span>
                                    <span class="badge  ml-1 " @click="ClassPaySet(item.cid,4)" :class="item.support[4]==1?'badge-success-lighten':'badge-danger-lighten'">积分</span>
                                </td>
                                <td>
                                    用户等级大于等于{{item.grade}}级
                                </td>
                                <td>
                                    {{item.date}}
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div v-if="Data.length===0" class="text-center w-100 mt-3 font-w300">
                    {{ type==-1?'正在载入中,请稍后...':'一个分类也没有' }}
                </div>
            </div>
        </div>
    </div>
</div>
<?php include 'bottom.php'; ?>
<script src="../assets/js/jquery.nestable.js"></script>
<script src="../assets/js/vue3.js"></script>
<script src="../assets/admin/js/classlist.js?vse=<?= $accredit['versions'] ?>"></script>
</body>

</html>